package mspbots.data.sync.logs.receivers;


import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import mspbots.data.sync.BaseReceiver;
import mspbots.data.sync.logs.entity.ExceptionLogs;
import mspbots.data.sync.logs.service.ExceptionLogsService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class SyncDataLogReceiver extends BaseReceiver {

    private final ExceptionLogsService exceptionLogsService;

    @RabbitListener(queues = "data.exception.log", concurrency = "5")
    public void processUsers(ExceptionLogs syncDataLog) {
        log.debug("RabbitListener [data.exception.log] SyncDataLog {}", syncDataLog);
        exceptionLogsService.save(syncDataLog);
    }
}
